<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		
		<link rel="stylesheet" href="./assets/styles/cellgrid.css" type="text/css" />
		
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="download";
					document.fm.submit();
				}
			});
			
			$('#btn-reset').click(function(){	
				location.href = document.fm.action;
			});
			
			$('#btn_search').click(function(){
					document.fm.csv.value="";
					document.fm.submit();
			});
			
			$('#year4').change(function(){
				var year4 = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				$.get("mmap_week_ajax.php",{ y: year4,t : nowtime }, function(data){
					$("#week_cd").children().remove();
					$("#week_cd").append( data ); 
				});
			});
			
			$('#week_cd').change(function(){
				var week_cd = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				$.get("ajax_title.php",{ w: week_cd,t : nowtime }, function(data){
					$("#title").children().remove();
					$("#title").append( data ); 
				});
			});
			
			$('.sort').change(function(){
				if (this.value == 2) {
					$('#tr_op3')['hide']();
					$('#tr_op2')['show']();
				}else if (this.value == 3) {
					$('#tr_op2')['hide']();
					$('#tr_op3')['show']();
				}else {
					$('#tr_op2')['hide']();
					$('#tr_op3')['hide']();
				}
			});
			
		});
		function toPage(thepage) {
			document.fm.page.value =  thepage;
			document.fm.csv.value="";
			document.fm.submit();
		}
		function setSS( valcd, valnm ) {
			if (gPara == "shop") {
				document.fm.sshop_cd.value = valcd;
				document.fm.sshop_name.value = valnm;			
			}
			if (gPara == "mediaid") {
				document.fm.media_cd.value = valcd;
				document.fm.media_name.value = valnm;			
			} 

			$('#dialog').dialog("close");
		}
	</script>
	<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
	<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>印刷手配管理</h2>
			<ul class="submenu clearfix">
				<li>月間.セール明細情報一覧</li>
			{{if !$isG23 }}	<li><a href="tmoncell_form.php">月間.セール明細情報登録</a></li>{{ /if }}
				<li><a href="tmoncell_update.php">月間.セール明細情報更新</a></li>
			{{if !$isG23 }}<li><a href="tmoncellprn_index.php">印刷部数明細</a></li>{{ /if }}
				<li><a href="tmoncellshop_index.php">店舗実施一覧表</a></li>
			</ul>
			<h3>月間.セール明細情報一覧</h3>
			<form name="fm" id="fm" method="get" action="tmoncell_index.php" >
				<input type="hidden" name="page" />
				<table class="formTable">
					<tbody>
						<tr>
							<th>年度※</th>
							<td>
&nbsp;{{ html_options id='year4' name='year4' options=$year4 selected=$forms.year4 }} 年{{ $err.year4 }}
							</td>
							<th>週名※</th>
							<td>
&nbsp;{{ html_options id='week_cd' name='week_cd' options=$week  selected=$forms.week_cd }}{{ $err.week_cd }}
							</tr>
						<tr>
							<th>種類</th>
							<td>
								&nbsp;{{ html_radios name='sort' class="sort" options=$cellsort selected=$forms.sort separator='&nbsp;' }}
							</td>
							<th>AJAREKSコード※</th>
							<td>
								<div id = "tr_op2"  style="display:{{if ($forms.sort == 2) }}block{{ else }}none{{ /if}};">
								&nbsp;{{ html_options name='areauser' options=$areauser selected=$forms.areauser }}{{ $err.areauser }}
								</div>	<div id = "tr_op3"  style="display:{{if ($forms.sort == 3) }}block{{ else }}none{{ /if}};">
								&nbsp;{{ html_options id='zone_cd' name='zone_cd'  options=$zone selected=$forms.zone_cd }}{{ $err.zone_cd }}
								</div>
								{{ $err.aja_cd }}
							</td>
						</tr>
						<tr>
							<th>店舗</th>
							<td colspan="3">
								&nbsp;<input type="text" name="sshop_name" class="text" value="{{ $forms.sshop_name|escape }}" readonly="readonly" />
								<input type="hidden" name="sshop_cd"  value="{{ $forms.sshop_cd|escape }}" />
								<button type="button" id="shop" class="btn_search" rel="shop"><span>参照</span></button>
								<button type="button" id="sshop_c" class = "btn_clear" rel="sshop"><span>クリア</span></button>
							</td>
						</tr><!--  
						<tr>
							<th>版サイズ</th>
							<td colspan="3">
								&nbsp;{{ html_options  name='mark' options=$mark selected=$vv.mark  }}
							</td>
						</tr>
						--><tr>
							<th>セールタイトル</th>
							<td colspan = 3>
								&nbsp;{{ html_options id='title' class="titlebase" name='title' options=$title selected=$forms.title  }}
							</td>
						</tr>
						<tr>
							<th>更新日</th>
							<td colspan="3">
							&nbsp;	<input type="text" name="upd_f" class="text_date" value="{{ $forms.upd_f }}" /> ～ 
								<input type="text" name="upd_t" class="text_date" value="{{ $forms.upd_t }}" />
							</td>
						</tr>
					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
				<input type="hidden" name="mapoperflg" />
			<hr>
{{ if is_numeric($count) }}
{{ if $count >0 }}
<p class="message">{{ $count }}件の情報が見つかりました。</p>
 <div class="l_head_div" id ="lhdiv">
 <table class="formTable" id = "head_tab_l" style="table-layout:fixed;word-wrap:break-word;word-break:break-all;" >
 <tr><th style="width:28px;height:80px">合<br/>同</th>
 <th style="width:60px">ゾーン<br/>AJA</th>
 <th style="width:45px">レ<br/>ギュ<br/>ラー</th>
 <th style="width:45px">イレ<br/>ギュ<br/>ラー</th>
 <th style="width:30px">地域<br/>1</th>
 <th style="width:30px">地域<br/>2</th>
 <th style="width:30px">地域<br/>3</th>
 <th style="width:30px">地域<br/>4</th>
 <th style="width:30px">地域<br/>5</th>
 <th style="width:70px">年商</th>
 <th style="width:38px">店舗<br/>コード</th> 
 <th style="width:120px">店舗名</th>
 </tr>
 </table>
 </div>
 <div class="r_head_div" id ="rhdiv" onscroll="document.getElementById('rdiv').scrollLeft=this.scrollLeft;">
 <table class="formTable" id = "head_tab_r"  style="table-layout:fixed;word-wrap:break-word;word-break:break-all;width:3000px">
 <tr>
		<th style="width:28px;height:80px">&nbsp;</th><th >前年売上<br/>高実績<br/>(千円)</th><th>前年<br/>セールタイトル</th><th style="width:220px;">本年<br/>セールタイトル</th>
		<th style="width:28px;"></th><th style="width:80px;">前年チラシ部数</th><th>パターン</th>
		<th style="width:80px;">本年チラシ部数</th><th style="width:138px;">パターン</th>
{{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<th style="width:220px;">{{$cv.name}}<br/>セールタイトル</th><th style="width:28px;"></th> <th style="width:80px;">{{$cv.name}}<br/>チラシ部数</th><th style="width:138px;">パターン</th>
{{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<th style="width:220px;">{{$cv.name}}<br/>前年<br/>セールタイトル</th><th style="width:220px;">{{$cv.name}}<br/>セールタイトル</th><th style="width:28px;"></th><th style="width:80px;">{{$cv.name}}</br>前年チラシ部数</th><th>{{$cv.name}}<br/>前年<br/>パターン</th> <th style="width:80px;">{{$cv.name}}<br/>チラシ部数</th><th  style="width:138px;">{{$cv.name}}<br/>パターン</th>
	{{ foreach from=$cv.weeks key=wck item=wcv name="cwsets" }}
		<th style="width:220px;">{{$wcv.name}}<br/>セールタイトル</th><th style="width:28px;"></th> <th style="width:80px;">{{$wcv.name}}<br/>チラシ部数</th><th>パターン</th>
	{{ /foreach }}
{{ /foreach }}
		</tr>
	</table>
 </div>

 <div class="l_div" id="ldiv" onscroll="document.getElementById('rdiv').scrollTop=this.scrollTop;"> 
 <table class="formTable" id = "1_tab_l" style="table-layout:fixed;word-wrap:break-word;word-break:break-all;" >
 <tr style="height:1px;"><th style="width:28px;height:1px"></th>
 <th style="width:60px"></th>
 <th style="width:45px"></th>
 <th style="width:45px"></th>
 <th style="width:30px"></th>
 <th style="width:30px"></th>
 <th style="width:30px"></th>
 <th style="width:30px"></th>
 <th style="width:30px"></th>
 <th style="width:70px"></th>
 <th style="width:38px"></th> 
 <th style="width:120px"></th>
 </tr>
 {{ foreach from=$data key=kk item=vv name="member" }}
  <tr><td rowspan=3>{{ $vv.mark }}</td>
	<td rowspan=3> {{ $vv.user_name }}</td>
	<td rowspan=3> {{ $vv.rgyu }}</td>
	<td rowspan=3> {{ $vv.irgyu }}<input type="hidden"  name="hirgyu[]" value="{{ $vv.irgyu }}" /></td>
	<td rowspan=3> {{ $vv.lnews1 }}</td>
	<td rowspan=3> {{ $vv.lnews2 }}</td>
	<td rowspan=3> {{ $vv.lnews3 }}</td>
	<td rowspan=3> {{ $vv.lnews4 }}</td>
	<td rowspan=3> {{ $vv.lnews5 }}</td>
	<td rowspan=3> {{ $vv.year_sale }}</td>
	<td rowspan=3> {{ $vv.shop_cd }}</td>
	<td rowspan=3> {{ $vv.shop_name }}</td>
	</tr><tr></tr><tr></tr>
{{ /foreach }}
 </table>
 </div>
<div class="r_div" id="rdiv" onscroll="document.getElementById('rhdiv').scrollLeft=this.scrollLeft;document.getElementById('ldiv').scrollTop=this.scrollTop;"> 
	<table class="formTable" id = "1_tab_r"  style="table-layout:fixed;word-wrap:break-word;word-break:break-all;width:3000px">
	<tr style="height:1px;">
		<th style="width:28px;height:1px;"></th><th></th><th></th><th style="width:220px;"></th>
		<th style="width:28px;"></th><th style="width:80px;"></th><th></th>
		<th style="width:80px;"></th><th style="width:138px;"></th>
{{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<th style="width:220px;"></th><th style="width:28px;"></th><th style="width:80px;"></th><th style="width:138px;"></th>
{{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<th style="width:220px;"></th><th style="width:220px;"></th><th style="width:28px;"></th><th style="width:80px;"></th><th></th> <th style="width:80px;"></th><th style="width:138px;"></th>
	{{ foreach from=$cv.weeks key=wck item=wcv name="cwsets" }}
		<th style="width:220px;"></th><th style="width:28px;"></th><th style="width:80px;"></th><th> style="width:138px;"</th>
	{{ /foreach }}
{{ /foreach }}
		</tr>
{{ foreach from=$data key=kk item=vv name="member" }}
 {{assign var="i" value=$smarty.foreach.member.index}}
 
	<tr>
	<td align=center>土</td><td> {{ $vv.lyear_sale6 }}</td>
	<td rowspan='3'>{{ $vv.ltitle_cd }}</td>
	<td rowspan='3'>{{ $vv.title_cd }}</td>
	
	<td align=center>B2</td>
	<td>{{ $vv.lnpc_b2}}</td>
	<td>{{ $vv.lpc_b2}}</td>
	<td>{{ $vv.npc_b2}}</td>
	<td>{{ $vv.pc_b2}}</td>

{{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<td rowspan='3'>{{ $vv[$cv.title_cd] }}</td>	
		<td align=center>B2</td>
		<td>{{ $vv[$cv.npc_b2]}}</td>
		<td>{{ $vv[$cv.pc_b2] }}</td>
{{ /foreach }}

{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<td rowspan='3'>{{ $vv[$cv.ltitle_cd] }}</td>	
		<td rowspan='3'>{{ $vv[$cv.title_cd] }}</td>	
		<td align=center>B2</td>
		<td>{{ $vv[$cv.lnpc_b2] }}</td>
		<td>{{ $vv[$cv.lpc_b2] }}</td>
		<td>{{ $vv[$cv.npc_b2] }}</td>
		<td>{{ $vv[$cv.pc_b2] }}</td>
		{{ foreach from=$cv.weeks key=wck item=wcv name="cwsets" }}
		 <td rowspan='3'>{{ $vv[$wcv.title_cd] }}</td>	
		 <td align=center>B2</td>
		<td>{{ $vv[$wcv.npc_b2]}} /></td>
		<td>{{ $vv[$wcv.pc_b2]}} /></td>
		{{ /foreach }}

{{ /foreach }}	  

	</tr>
	<tr>
		<td align=center>日</td><td>{{ $vv.lyear_sale7 }}</td>
		<td align=center>B3</td>
		<td>{{ $vv.lnpc_b3}}</td>
		<td>{{ $vv.lpc_b3}}</td>
		<td>{{ $vv.npc_b3}}</td>
		<td>{{ $vv.pc_b3}}</td>
		
 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<td align=center>B3</td>
		<td>{{ $vv[$cv.npc_b3]}}</td>
		<td>{{ $vv[$cv.pc_b3]}}</td>
 {{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<td align=center>B3</td>
		<td>{{ $vv[$cv.lnpc_b3] }}</td>
		<td>{{ $vv[$cv.lpc_b3] }}</td>
		<td>{{ $vv[$cv.npc_b3] }}</td>
		<td>{{ $vv[$cv.pc_b3] }}</td>
		{{ foreach from=$cv.weeks key=wck item=wcv name="cwsets" }}
		 <td align=center>B3</td>
		<td>{{ $vv[$wcv.npc_b3]}}</td>
		<td>{{ $vv[$wcv.pc_b3]}}</td>
		{{ /foreach }}
{{ /foreach }}
	</tr>
		<tr>
		<td align=center>計</td><td>{{ $vv.lyear_sale }}</td>
		<td align=center>B4</td>
		<td>{{ $vv.lnpc_b4 }}</td>
		<td>{{ $vv.lpc_b4 }}</td>
		<td>{{ $vv.npc_b4 }}</td>
		<td>{{ $vv.pc_b4 }}</td>
 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<td align=center>B4</td>
		<td>{{ $vv[$cv.npc_b4]}}</td>
		<td>{{ $vv[$cv.pc_b4]}}</td>
 {{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<td align=center>B4</td>
		<td>{{ $vv[$cv.lnpc_b4] }}</td>
		<td>{{ $vv[$cv.lpc_b4] }}</td>
		<td>{{ $vv[$cv.npc_b4] }}</td>
		<td>{{ $vv[$cv.pc_b4] }}</td>
		{{ foreach from=$cv.weeks key=wck item=wcv name="cwsets" }}
		<td align=center>B4</td>
		<td>{{ $vv[$wcv.npc_b4]}}</td>
		<td>"{{ $vv[$wcv.pc_b4]}}</td>
		{{ /foreach }}
{{ /foreach }}
	</tr>
{{ /foreach }}
	</table>
</div>

				<p class="button">
					<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
				</p>
{{ else }}
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}
			</form>
<div id="dialog" >
</div>
		</div></div>
		{{ $footer }}
	</body>
</html>